﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using AssessmentActions;
using TestingLibrary;

public partial class Teacher_TestViewControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        update();
    }
    protected void submitButton_Click(object sender, EventArgs e)
    {

    }

    public void setAssessment(string serialized_assessment)
    {
        ViewState["CurrentAssessment"] = serialized_assessment;
        update();
    }

    public void update()
    {
        string serialized_assessment = (string)ViewState["CurrentAssessment"];

        if (serialized_assessment != null)
        {
            try
            {
                Assessment assessment = 
                    TestingLibrary.TestingFunctions.deserializeAssessment(serialized_assessment);

                String test_view = assessment.getAssessmentHtmlWithSelectors();

                testViewLabel.Text = "<div style=\"background-color: #fff; border: 2px solid #777;\">" + test_view + "</div>";
            }
            catch (Exception)
            {
            }
        }
    }
}